package com.trkj.dao.wdm;

import java.util.List;

import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.trkj.pojo.StaffInformation;
import com.trkj.vo.ShouYeVo;

public interface StaffInformationDAO extends CrudRepository<StaffInformation, Long>{
		@Query("from StaffInformation s   where s.stainName=?1")
		public StaffInformation queryName(String name);
		@Query("select s,d,l from StaffInformation s inner join s.definitionDept d inner join s.laborTurnovers l where l.voluntaryTurnover=0")
		public List<Object[]> queryByNamePage(Pageable p);
		
		@Query("FROM StaffInformation s")
		public List<StaffInformation> findAllqindan(Pageable p);
		/*@Query("select s from StaffInformation s")
		public List<StaffInformation> queryAll(Pageable p);*/
	
		//  inner join s.laborTurnovers l
		
		@Query("select s,e from StaffInformation s inner join s.emppasses e where s.stainName = ?1 and e.passPwd = ?2")
		public List<Object[]> queryLogin(String name,String pwd);
		
		@Query("select s from StaffInformation s left join"
				+ " s.definitionDept d left join s.professionalTitle p left join s.edubackground e"
				+ " left join s.jobStatus j left join s.laborTurnovers l where l.voluntaryTurnover=0")
		public List<StaffInformation> queryAll(Pageable p);
		
		@Query("select s,d from StaffInformation s left join s.definitionDept d where s.stainId= ?1")
		public  List<Object[]> querysy(Long stainId);
		
		@Query("select s from StaffInformation s left join"
				+ " s.definitionDept d left join s.professionalTitle p left join s.edubackground e"
				+ " left join s.jobStatus j left join s.laborTurnovers l where l.voluntaryTurnover=0 and s.stainName like ?1")
		public  List<StaffInformation> queryLikeName(String name,Pageable p);
		
		
		
		
		
		
		
		
		
		
}